const mongoose = require('mongoose')
const { dbUri } = require('../config');
mongoose.connect(dbUri, {
  useUnifiedTopology: true,
  useNewUrlParser: true
})
let db = mongoose.connection
db.on('error', function (err) {
  console.log('MongoDB 数据库连接失败:', err);
})
db.once('open', function () {
  console.dir(`${dbUri} is open`)
})

module.exports = {
  mongoose
}
